<?php
    @include_once('config.php');
   
    $key = $_GET["key"];
    $orderkey = $_GET["orderkey"];
    $rankkey = $_GET["rankkey"];
    $shownum = $_GET["shownum"];
    $skipnum = $_GET["skipnum"];


    // echo '连接成功';
    $sql = "select  * FROM productsinfo WHERE goodsname like '%$key%' order by $orderkey $rankkey";

    $sql = "select  * from  productsinfo where goodsname like '%$key%'";

    $sql .= "limit  $skipnum,$shownum ";
 
    $res = mysql_query($sql);

    $list  = array();
  
    while($item = mysql_fetch_array($res)){
        $temp  = array();
        $temp["id"]=$item["id"];
        $temp["goodsname"] = $item["goodsname"];
        $temp["goodsnum"] = $item["goodsnum"];
        $temp["goodsprice"] = $item["goodsprice"];
        $temp["goodssmallimg"] = $item["goodssmallimg"];

        $list[] = $temp;
    }

    echo  json_encode($list);
?>  